package cn.tedu.controller;

import cn.tedu.pojo.ApplicationForm;
import cn.tedu.pojo.Chapter;
import cn.tedu.service.RemoteService;
import cn.tedu.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/application")
public class ApplicationController {
    @Autowired
    private RemoteService remoteService;

    //作者角色申请及小说发表申请
    @PutMapping("/roleAndNovelApplication")
    public SysResult roleAndNovelApplication(@RequestBody ApplicationForm applicationForm){
        remoteService.roleAndNovelApplication(applicationForm);
        return SysResult.success();
    }

    //小说章节核审,返回小说书名
    @PutMapping("/chapterApplication")
    public SysResult chapterApplication(@RequestBody Chapter chapter){
        String novelName = remoteService.chapterApplication(chapter);
        return SysResult.success(novelName);
    }

    //获取编辑回馈或发送的信息
    @GetMapping("/getEditorToAuthor")
    public SysResult getEditToAuthor(@RequestParam("author") String author){
        ApplicationForm applicationForm =remoteService.getEditToAuthor(author);
        return SysResult.success();
    }
}
